import csv

# 1.写
# newline=''  ==>  不换行d
file = open('test_csv.csv', mode='w', encoding='utf8', newline='')
w = csv.writer(file)
w.writerow(['name', 'age'])
w.writerow(['s1', 14])
w.writerow(['s2', 15])
w.writerows(
    [
        ['s3', 15],
        ['s4', 14],
        ['s五', 14]
    ]
)

file.close()

# 2.读
file = open('info.csv', mode='r', encoding='utf8')
r = csv.reader(file)
for row in r:
    print(row)

file.close()
